]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
inputMethod: Try to connect require-surrounding-text signal
authorTakao Fujiwara <tfujiwar@redhat.com>
Fri, 3 Mar 2023 08:50:10 +0000 (17:50 +0900)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 8 Aug 2023 09:59:02 +0000 (11:59 +0200)
require-surrounding-text signal has been added since IBus 1.5.28.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6405
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2668>

js/misc/inputMethod.js

index 1ac1dff572d837fab71afb8d22e3d79c09014c8d..aabd280c85dc37e53d2631c795e8dea8d67f9968 100644 (file)
@@ -16,6 +16,8 @@ Gio._promisify(IBus.InputContext.prototype,
 
 const HIDE_PANEL_TIME = 50;
 
+const HAVE_REQUIRE_SURROUNDING_TEXT = GObject.signal_lookup('require-surrounding-text', IBus.InputContext);
+
 export const InputMethod = GObject.registerClass({
     Signals: {
         'surrounding-text-set': {},
@@ -80,7 +82,6 @@ export const InputMethod = GObject.registerClass({
 
         this._context.set_client_commit_preedit(true);
         this._context.connect('commit-text', this._onCommitText.bind(this));
-        this._context.connect('require-surrounding-text', this._onRequireSurroundingText.bind(this));
         this._context.connect('delete-surrounding-text', this._onDeleteSurroundingText.bind(this));
         this._context.connect('update-preedit-text-with-mode', this._onUpdatePreeditText.bind(this));
         this._context.connect('show-preedit-text', this._onShowPreeditText.bind(this));
@@ -88,6 +89,9 @@ export const InputMethod = GObject.registerClass({
         this._context.connect('forward-key-event', this._onForwardKeyEvent.bind(this));
         this._context.connect('destroy', this._clear.bind(this));
 
+        if (HAVE_REQUIRE_SURROUNDING_TEXT)
+            this._context.connect('require-surrounding-text', this._onRequireSurroundingText.bind(this));
+
         Main.keyboard.connectObject('visibility-changed', () => this._updateCapabilities());
 
         this._updateCapabilities();